﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data.SQLite;

namespace Classes
{
   public class CorporateData
   {
      #region Private Member Variables

         private String ar, csid, rep, type, office;

      #endregion

      #region Properties

      public String AR_Number          { get { return ar; } }
      public String CSID_Num           { get { return csid; } }
      public String InstallingOffice   { get { return office; } }
      public String SellingRep         { get { return rep; } }
      public String Acct_Type          { get { return type; } }
      public String DBString
      {
         get
         {
            return String.Format("'{0}', '{1}', '{2}', '{3}', '{4}'",
               ar, csid, type, rep, office);
         }
      }

      #endregion

      #region Constructors

      /// <summary>
      /// Creates a new CorporateData object with individual parameters.
      /// </summary>
      /// <param name="iAR">Account Reference Number</param>
      /// <param name="iCSID">Call Station ID</param>
      /// <param name="iRep">Selling Rep</param>
      /// <param name="iOffice">Installing Office</param>
      /// <param name="iType">Type of Account</param>
      public CorporateData (String iAR, String iCSID, String iRep, String iOffice, String iType)
      {
         ar       = iAR;
         csid     = iCSID;
         rep      = iRep;
         office   = iOffice;
         type     = iType;
      }

      /// <summary>
      /// Creates a new CorporateData object from a database record.
      /// </summary>
      /// <param name="row">Single database record.</param>
      public CorporateData(SQLiteDataReader row)
      {
         ar = row["AR"].ToString();
         csid = (String)row["CSID"];
         rep = (String)row["Rep"] ;
         office = (String)row["Office"];
         type = (String)row["Type"];
      }

      #endregion
   }
}
